/*
 * Esta clase gestiona la información requerida por la aplicación 
 * mientra dure la sesión del usuario logeado
 */
package system.general;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author emojica
 */
@ManagedBean(name="logged")
@SessionScoped
public class Logged {

    //variables para gestionar el usuario logeado
    private int loggedId = 0;
    //Variable para gestionar el rol de usuario
    private int loggedRol = 0;
    private String loggedName;
    private String loggedIdiom = "es";
    //Variables para gestionar los registros
    private int masterId = 0;
    private String masterName;
    private int detailId = 0;
    public int tempId = 0;
    //Variables para gestionar los menus
    private String menuFolder;
    private String packageName;
    private String moduleName;
    private String moduleAccess;
    public List<Integer> list_receptor = new ArrayList<>();

    public String getModuleName() {
        return moduleName;
    }

    public void setModuleName(String aModuleName) {
        moduleName = aModuleName;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String aMenuName) {
        packageName = aMenuName;
    }

    public int getDetailId() {
        return detailId;
    }

    public void setDetailId(int aDetailId) {
        detailId = aDetailId;
    }

    public String getMasterName() {
        return masterName;
    }

    public void setMasterName(String aMasterName) {
        masterName = aMasterName;
    }
    private Map<String, String> map = new HashMap<>();

    public Logged() {
    }

    public String getMenuFolder() {
        return menuFolder;
    }

    public void setMenuFolder(String aModuleName) {
        menuFolder = aModuleName;
    }

    public int getLoggedId() {
        return loggedId;
    }

    public void setLoggedId(int aUsrId) {
        loggedId = aUsrId;
    }

    public String getLoggedName() {
        return loggedName;
    }

    public void setLoggedName(String aUsrName) {
        loggedName = aUsrName;
    }

    public String getLoggedIdiom() {
        return loggedIdiom;
    }

    public void setLoggedIdiom(String aUsrIdiom) {
        loggedIdiom = aUsrIdiom;
    }

    public int getMasterId() {
        return masterId;
    }

    public void setMasterId(int aId) {
        masterId = aId;
    }

    public Map<String, String> getMap() {
        return map;
    }

    public void setMap(Map<String, String> map) {
        this.map = map;
    }

    public void clearFind() {
        map.clear();
    }

    public void clearRecord() {
        masterId = 0;
        masterName = "";
        detailId = 0;
        setTempId(0);

    }

    public void clearMenu() {
       masterId = 0;
        masterName = "";
        menuFolder = "";
        packageName = "";
        moduleName = "";
        clearFind();
    }

    public void clearAll() {
        loggedId = 0;
        loggedName = "";
        loggedIdiom = "es";
        loggedRol = 0;
        clearMenu();
        clearFind();
    }

    public String getModuleAccess() {
        return moduleAccess;
    }

    public void setModuleAccess(String moduleAccess) {
        this.moduleAccess = moduleAccess;
    }

    public List<Integer> getList_receptor() {
        return list_receptor;
    }

    public void setList_receptor(List<Integer> list_receptor) {
        this.list_receptor = list_receptor;
    }

    public int getTempId() {
        return tempId;
    }

    public void setTempId(int tempId) {
        this.tempId = tempId;
    }

    /**
     * @return the loggedRol
     */
    public int getLoggedRol() {
        return loggedRol;
    }

    /**
     * @param loggedRol the loggedRol to set
     */
    public void setLoggedRol(int loggedRol) {
        this.loggedRol = loggedRol;
    }
}
